import sys
from loguru import logger
from config import AppConfig
from clients import GerritClient, DifyClient
from executor import WorkflowExecutor
from app import create_app


logger.remove()
logger.add(sys.stdout, level='INFO')

if __name__ == '__main__':
    appconfig = AppConfig()
    appconfig.ensure_loaded()
    dify_client = DifyClient(appconfig)
    gerrit_client = GerritClient(appconfig)
    workflow_executor = WorkflowExecutor(dify_client, gerrit_client)
    app = create_app(gerrit_client, workflow_executor)
    app.run(debug=False, host='0.0.0.0', port=7070, use_reloader=False)

